 class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
      TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
          this.left = left;
          this.right = right;
      }
class Solution {
    public boolean isSymmetric(TreeNode root) {
        if(root==null){
            return true;
        }
        return isSymmetric(root.left,root.right);
    }
     public boolean isSymmetric(TreeNode Left,TreeNode Right) {
        if(Left==null&&Right!=null||Right==null&&Left!=null){
            return false;
        }
        if(Left==null&&Right==null){
            return true;
        }
        if(Left.val!=Right.val){
            return false;
        }
        //左右结点不为空，且相等
    return isSymmetric(Left.left,Right.right)&&isSymmetric(Left.right,Right.left);

    }
}
